import { request } from '@/service/request';
import { QuickLink } from "@/views/dashboard/modules/link";

export function fetchLink(id: Common.IdType) {
  return request({
    url: `/workbench/link/${id}`,
    method: 'GET',
  });
}

export function fetchLinkPage(page: Common.Page<QuickLink>, searchData: any) {
  return request({
    url: '/workbench/link/list',
    data: { page, searchData },
    method: 'POST',
  });
}

export function fetchAddLink(data: QuickLink) {
  return request({
    url: '/workbench/link/',
    data: data,
    method: 'POST',
  });
}

export function fetchUpdateLink(data: QuickLink) {
  return request({
    url: '/workbench/link/',
    data: data,
    method: 'PUT',
  });
}

export function fetchDelLink(ids: Common.IdType[]) {
  return request({
    url: `/workbench/link/${ids}`,
    method: 'DELETE',
  });
}

export function fetchInitData() {
  return request({
    url: '/workbench/link/getInitData',
    method: 'GET',
  });
}
